

<?php
error_reporting(E_ALL);
$user_email = $_GET["user_email"];
$con = mysqli_connect("localhost","davidjwa_hack","hackathon16","davidjwa_hack");
// Check connection


if (mysqli_connect_errno())
{
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM users WHERE user_email = '$user_email' ");
echo "<html>";
echo "<form name=\"input\" action=\"alter-user.php\" method=\"post\"><br />";

//var_dump($result);
while($row = mysqli_fetch_array($result)) {

echo "First Name:<input type=\"text\" name=\"fname\" value=". $row["fname"] ."><br />";
echo "Surname: <input type=\"text\" name=\"sname\" value=". $row['sname']."><br />";
echo "Preferred name: <input type=\"text\" name=\"pname\" value=". $row['pname']."><br />";
echo "User EMail: <input type=\"text\" name=\"user_email\" value=". $row['user_email']."><br />";
echo "Passcode: <input type=\"text\" name=\"passcode\" value=". $row['passcode']."><br />";
echo "D.O.B.: <input type=\"text\" name=\"dob\" value=". $row['dob']."><br />";
echo "Needs: <input type=\"text\" name=\"needs\" value=". $row['needs']."><br />";
echo "<input type=\"hidden\" name=\"orig_email\" value=". $row['user_email']."><br />";
}
echo "<input type=\"submit\" value=\"Submit\">";
echo "</form>";
echo "</html>";
mysqli_close($con);